package de.backtomedieval.units;

public class UnitOrder {



	private int buildCountdown = 0;
	private int fullBuildCountdown = 0;
	private int buildCount = 0;
	private int fullBuildCount = 0;
	private AbstractUnit unit = null;
	
	public UnitOrder(AbstractUnit unit, int count) {
		this.fullBuildCount = count;
		this.buildCountdown = unit.getBuildCountdown();
		this.fullBuildCountdown = unit.getBuildCountdown();
		this.unit = unit;
	}
	
	public int getBuildCountdown() {
		return buildCountdown;
	}
	public void setBuildCountdown(int buildCountdown) {
		this.buildCountdown = buildCountdown;
	}
	
	public String getBuildPercent() {
		return ((fullBuildCountdown - buildCountdown )*100/fullBuildCountdown) + "%";
	}
	
	public String getBuildCountPercent() {
		return buildCount + "/" +  fullBuildCount;
	}
	
	public int getBuildCount() {
		return buildCount;
	}

	public void setBuildCount(int buildCount) {
		this.buildCount = buildCount;
	}

	public AbstractUnit getUnit() {
		return unit;
	}

	public void setUnit(AbstractUnit unit) {
		this.unit = unit;
	}
	
	public int getFullBuildCountdown() {
		return fullBuildCountdown;
	}

	public void setFullBuildCountdown(int fullBuildCountdown) {
		this.fullBuildCountdown = fullBuildCountdown;
	}

	public int getFullBuildCount() {
		return fullBuildCount;
	}

	public void setFullBuildCount(int fullBuildCount) {
		this.fullBuildCount = fullBuildCount;
	}
	
	public boolean isBuilded() {
		if (this.getBuildCountdown()==0) {
			return true;
		} else {
			return false;
		}
	}
	
	public boolean isOrderComplete() {
		if (buildCount == fullBuildCount) {
			return true;
		} else {
			return false;
		}
	}
	
	public boolean orderProgress() {
		buildCount++;
		return isOrderComplete();
	}
	
	
}
